export default {
    namespaced: true,
    state: {
        //是否显示提示框
        isShowToast: false,
        // 提示内容
        toastMsg: "1",
        //提示类型
        toastType: "success",//success（绿色）  danger(红色)  warning(黄色)
    },
    getters: {
    },
    mutations: {
        //修改是否显示模态框的数据
        changIsShowToast(state, payload) {
            state.isShowToast = payload.isShow;
            if (payload.isShow) {
                state.toastMsg = payload.title;
                state.toastType = payload.type;
            }
        } 
    },
    actions: {
        asyncIsShowToast({commit},payload){
            console.log("asyncIsShowToast-----");
            //第一步.显示提示框
            commit("changIsShowToast",payload);
            //第二步 异步操作隐藏提示框
            setTimeout(() => {
                commit("changIsShowToast",{
                    isShow:false
                })
            }, 1000);
        }
    },
}